#include "stdafx.h"

typedef struct tagOrange{
	AVFormatContext *pFormatCtx;
	SwsContext* sws;
	int videoStream;
	int audioStream;

	AVCodecContext *aCodecCtx;
	AVCodecContext *vCodecCtx;
#define pCodecCtx vCodecCtx

	AVCodec* aCodec;
	AVCodec* vCodec;
#define pCodec vCodec

	AVFrame *vFrame;
#define pFrame vFrame

	FLOAT fps;
	HANDLE hAudioLock;
	HANDLE hAudioSignal;
	HANDLE hRenderSignal;
	HWAVEOUT waveOut;
	WAVEFORMATEX aFormat; 
	int waveBufferAllocated;
	DWORD aThread;
	HANDLE aThreadHandle;
	HWND hWnd;
	BOOL pause;
}Orange, *LPORANGE;

/**
 * $Id: av.h 30 2010-08-03 12:32:42Z bearice $
 * Copyright (C) 2010 Bearice
**/
HRESULT AV_Init(HWND hWnd);

HRESULT AV_NextFrame(LPORANGE o,AVFrame* targetFrame);

HRESULT AV_LoadOrange(HWND hWnd,LPORANGE o,TCHAR*,int w,int h,enum PixelFormat fmt);

void AV_FreeOrange(LPORANGE o);